/**
 * 依赖aServer.js, log.js
 */
var attendServer = mui.extend(aServer || {}, {
	isDebug: true,

	// 获取用户信息
	userdetails: function(success, error) {
		aServer.executeActionOfServerGet(this.isDebug, "/api/userdetails", "获取用户信息失败", "", success,
			error);
	},
	// 获取班次信息
	shiftinfo: function(success, error) {
		aServer.executeActionOfServer(this.isDebug, "/api/shiftinfo", "获取班次信息失败", "", success,
			error);
	},
	// 获取打卡地点
	locations: function(success, error) {
		aServer.executeActionOfServerGet(this.isDebug, "/api/locations", "获取打卡地点失败", "", success,
			error);
	},

	//上下班签到 
	attendee: function(signLatitude, signLongitude, signType, Precision, poiName, shiftId, success, error) {
		var signDateTime = new Date().getTime();
		var url = "/api/attendee" + "?signLatitude=" + signLatitude + "&signLongitude=" + signLongitude +
			"&signType=" + signType + "&Precision=" + Precision + "&poiName=" + poiName + "&shiftId=" +
			shiftId + "&signDateTime=" + signDateTime;
		aServer.executeActionOfServer(this.isDebug, url, "打卡失败", {}, success, error);
	},

	// 获取当月的日历详情
	attcalendar: function(date, success, error) {
		var data = {
			date: date
		};
		var url = "/api/attcalendar" + "?date=" + date;
		aServer.executeActionOfServerGet(this.isDebug, url, "获取当月的日历详情失败", {}, success, error);
	},

	// 获取用户单日打卡详情
	userSignDetails: function(date, success, error) {
		var data = {
			date: date
		};
		var url = "/api/user-sign-details" + "?date=" + date;
		aServer.executeActionOfServerGet(this.isDebug, url, "获取用户打卡信息失败", {}, success, error);
	},

	// 获取异常类型
	remarkType: function(success, error) {
		aServer.executeActionOfServerGet(this.isDebug, "/api/remark-type", "获取异常类型失败", "", success,
			error);
	},
	//获取异常说明记录
	getRemark: function(remarkId, success, error) {
		var url = "/api/remark" + "?remarkId=" + remarkId;
		aServer.executeActionOfServerGet(this.isDebug, url, "获取异常说明记录失败", "", success,
			error);
	},

	//异常处理
	remark: function(remarkType, beginDate, endDate, remark, classId, signId, remarkId, success, error) {
		var url = "";
		if (beginDate.length > 0) {

			url = "/api/remark" + "?remarkType=" + remarkType + "&beginDate=" + beginDate + "&endDate=" +
				endDate + "&remark=" + remark + "&classId=" + classId +
				"&remarkId=" + remarkId;
		} else {
			url = "/api/remark" + "?remarkType=" + remarkType + "&remark=" + remark + "&classId=" +
				classId + "&signId=" + signId +
				"&remarkId=" + remarkId;
		}

		aServer.executeActionOfServer(this.isDebug, url, "异常处理提交失败", {}, success, error);
	},

});
